Repository navigation
Every step of PR work knows the other repositories its change reaches - #979
Conversation
A check red on the pull request and green on the base first gets the mode diagnosis: files the pull request changes are compared with the merge base, and a mode CoderHelm's commits dropped is put back in one commit with no model round; what can't be put back yet is CoderHelm's own problem, alerted and retried. restore_file restores the mode with the bytes, set_mode sets a file's executable bit (refusing links and submodules), and a sandbox chmod says it never reaches the commit. The repair sweep compares with the base, reads failed runs first and resumes a run that ended on red CI. Every worker loop with tools gets list_repos, read_repo_file and search_repo over the team's installation, with the prompt; Chat's prompt says the same. Text claiming CoderHelm can't see or confirm something is rejected unless a tool returned a refusal it names.
…ate the cases it moved
…nd stuck repairs The guard reads first-person claims only (I, we, CoderHelm, the agent): sentences about the code or the product pass untouched. It reads prose lines only: fenced code, data lines and structured output are never read or edited. A look-first retry that fails or runs out of time keeps the first answer and the history it came from. The claim check is part of person_text itself. A stuck mode repair retries while the tries put more back; after three tries with no progress it stops, records why once as its own problem, and the run waits on CI. A sweep whose branch moved gives its claim back. A failed installation read is kept for seconds, not minutes, and a comparison cut at one page says so.
…itories Reading stays allowed everywhere. Visibility comes from the installation's repository list; a repository it doesn't name as public counts as private. A reply going to a public repository keeps every private read of its turn and is checked before sending: no verbatim line or code from those reads, no private repository name or path. It is asked for its conclusion in plain words, and what still carries private content is taken out, in prose and structured replies alike, never replaced by a claim that it can't see the code.
An installation contract index, built with each repository's code graph and refreshed on every push, records per repository the endpoints, GraphQL fields, events, packages, imported symbols and environment variables it exposes and uses (common::contracts). Every pass of PR work reads it (passes::xrepo): the planner sees the consumers and a plan that ignores them goes back; the coder and every round through it start with the consumers' lines; the reviewer raises a removed contract a consumer still uses as a required finding; a pull request touching contracts others use carries a compatibility section unless it changes them. Every loop has find_consumers. Reading stays unrestricted. Private reads by work posting to a public repository are kept per installation; a write tool copying them is refused, and every text the GitHub client writes there has them taken out by the same leak check. Incident xt holds the invariants.
…gets its contracts read, and private reads outlive the process - A package renamed in its manifest counts as removed; an endpoint moved to another HTTP method is a break, not a rewrite. Removals are matched by the patch's removed text, not by the index's line numbers, which may come from another commit than the pull request's base. - Repositories with no record, and dependents of a newly exposed package, get a contracts-only read with its own queue mark, which never reads the code graph's status: a repository whose graph is built is read too. Its graph and build status are left as they are. - What work posting to a public repository reads in private ones is also kept in a short-lived store item per installation, public repository and run. Every model loop waits for it to be stored, and the GitHub client reads it back before each write, so a write in a later invocation is held to an earlier read. - An unreadable index record is logged; per-step index logs are debug.
Superseded by CoderHelm's latest review
When the installation's listing can't be read, or doesn't name a repository, that repository counts as private when it was read and as public when it is written to (reach::Visibility). Only a target the listing names, and not as public, is private. The model loops, the contract index view and so the GitHub client's held writes all decide through it, and a loop whose listing failed still keeps its reads under the team's installation. Reading is never limited by it.
| ) -> Result<(), String> { | ||
| use aws_sdk_dynamodb::primitives::Blob; | ||
| use aws_sdk_dynamodb::types::AttributeValue; | ||
| dynamo |
There was a problem hiding this comment.
💬 Suggestion: Record write is an unconditional read-modify-write (hardening)
save_record does a plain put_item of the whole record. refresh_contracts in code_graph.rs (around line 970) loads the stored record, replaces only the pushed files' entries and saves it back. If two index passes for the same repository overlap, the later write is based on the older record. The earlier pass's changed files then revert to their previous entries, and nothing re-reads them until they change again. I couldn't tell whether index passes are serialized per repository, so this is an unconfirmed concern. A conditional write on the stored commit or updated_at, with a re-read on conflict, would close it. The existing graph item writes follow the same unlocked pattern, so this is hardening, not a regression.
| // What the patch removes, by its text: the index's line numbers | ||
| // may come from another commit than the pull request's base. | ||
| let removed: Vec<String> = removed.into_iter().map(|(_, t)| t).collect(); | ||
| let links = self.links(repo, std::slice::from_ref(path)); |
There was a problem hiding this comment.
💬 Suggestion: breaks can miss a consumer once the file's links pass the 40-link cap (correctness, not verified)
breaks takes its consumers from self.links(repo, [path]), which sorts by direction, then environment, then kind, and truncates to MAX_LINKS (40). For a file with many contracts, such as a large router or a manifest with many dependents, consumer links for a removed contract can fall past the cap. That break is then silently not reported. A small internal variant of links without the cap, or a cap applied only after breaks has matched each entry, would avoid it.
This blocks: breaks is the change's core data-loss path: a removed contract with a used consumer is silently not reported, defeating the stated goal, shown by the cap truncation
| let body = crate::app_map::gzip(&serde_json::to_vec(&new).unwrap_or_default()); | ||
| let expires = chrono::Utc::now().timestamp() + LEDGER_KEEP_SECS as i64; | ||
| let run = if run.is_empty() { "step" } else { run }.to_string(); | ||
| let handle = rt.spawn(async move { |
There was a problem hiding this comment.
💬 Suggestion: A failed refill is retried on every public write (hardening, not verified)
In refill, the Err(e) arm only logs a WARNING. REFILLED is set only on success, so during a store outage every POST, PATCH or PUT to a public repository runs a fresh DynamoDB query and logs again. The store is hit on each write and the log fills up. Also, query orders by sk (RUN#{run}#...), not by time. If more than REFILL_MAX_ITEMS batches exist for one target, the batches dropped are not the oldest ones. Both are edge cases, and the process's own in-memory reads are still checked.
Superseded by CoderHelm's latest review
|
💚 Post-merge health check passed: the deploy of
|
Summary
PR work now knows the whole installation the way a senior developer does. An installation-level contract index, built with each repository's code graph and refreshed on every push, records per repository what it exposes and what it uses: HTTP endpoints, GraphQL root fields, events and queue messages, packages and the symbols imported from them, and environment variables. Every pass of PR work reads it. Planning, coding, fix and CI rounds, review and the pull request itself all know which other repositories a change reaches. A contract change with known consumers never ships without either changing them or an explicit compatibility note. Reading stays unrestricted. Nothing written into a public repository names a private one or copies its code, on any surface.
Builds on #973 (repo_reach's read tools and leak check), now on main.
Changes
common::contracts(new): the index.Query,MutationandSubscriptionfields, and the operations that use them;package.json,Cargo.toml,pyproject.toml,go.modandrequirementsnames and dependencies;Index::linksworks out consumers and producers in memory.Index::breaksfinds a contract a patch removes or renames while another repository still uses it.find_consumerstool and its prompt.code_graph::refresh_contractsruns in the same index pass. A first build reads every file. A push replaces only the changed files' entries. A newly exposed package has its dependents read again (at most 10).passes::xrepo(new): what each step reads. It rides inRepoGraphs::load_mapnext to the app map, so every pass that already reads code gets it.## owner/repogroup for each consumer (the existing multi-repository plan) or a## Compatibilitysection.find_consumersis offered beside the read tools, and the prompt says to ask it before changing or explaining a contract.repo_reach::leak/redact):repo_reach::note_private), including what the index showed the run.agent::reach::Exec).title,body,messageand inline comment bodies before it reaches a public repository (clients::github::public_payload). That covers pull requests, commits, comments, reviews, dismissals and releases.owner/name, so common words stay readable.xt_contract_change_reaches_every_consumer(case and page), the new caches listed inbm, and docs incode-map.md.Cost bounds:
Verification
cargo fmt --all --checkandrustfmt --checkon the incidents: clean.cargo clippy -p common -p worker -p gateway --all-targets -- -D warnings: clean.cargo test -p common -p worker -p gateway, after merging main: common 3,337 passed, gateway 1,363 passed, worker 2,958 passed, none failed.brand_spelling.pyanddomain_examples.py: clean.contracts::tests).repo_reach,agent::reach).xtincident covers: